#pragma once 
#include <iostream>
#include <pthread.h>


class Task
{
  private:
    int x;
    int y;
    char op;

  public:
    Task()
    {

    }
    Task(int _x,int _y,char _op):x(_x),y(_y),op(_op)
    {}

    void run()
    {
      int z=0;
      switch(op)
      {
        case '+':
          z=x+y;
          break;
        case '-':
          z=x-y;
          break; 
        case '*': 
          z=x*y;
          break; 
        case '/':
          if(y==0)
            printf("div zero\n");
          else 
            z=x/y;
          break;
        case '%':
          if(y==0)
            printf("mod zero\n");
          else 
            z=x%y;
           break; 
        default:
           perror("operator error\n");
      }
    printf("%d:%d%c%d=%d\n",(int)pthread_self(),x,op,y,z);
    }
    ~Task()
    {}
};
